<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="resource-type" content="document">
<meta name="description" content="The OpenBSD Ports and Packages Collection">
<meta name="keywords" content="openbsd,ports">
<meta name="distribution" content="global">
<meta name="copyright" content="copyright 1997-2007 by OpenBSD.">
<title>OpenBSD Ports and Packages</title>
<link rev="made" href="mailto:www@openbsd.org">
</head>

<body text="#000000" bgcolor="#FFFFFF" link="#23238E">

<a href="index.html"><img alt="[OpenBSD]" height="30" width="141" src="images/smalltitle.gif" border="0"></a>

<h2><font color="#e00000">The Ports &amp; Packages collection</font></h2>

<hr>

<h3><font color="#0000e0">Index</font></h3>
<ul>
<li><a href="#Motivation">Motivation</a></li>
<li><a href="#Get">Getting Packages</a></li>
<li><a href="#stable">Ports and Packages Update for an OpenBSD Release</a></li>
<li><a href="#Manage">Managing Installed Packages</a></li>
<li><a href="#Use">Using Ports</a></li>
<li><a href="#Life">Life Cycle of the Ports Tree</a></li>
<li><a href="#X">Ports and the X Window System</a></li>
<li><a href="#Example">Example Use of the Ports Tree</a></li>
<li><a href="#Advanced">Advanced Usage of the Ports Tree</a></li>
<li><a href="#Create">Creating New Ports</a></li>
<li><a href="#Lag">When a Port Is Lagging Behind the Mainstream Version</a></li>
<li><a href="#Help">Problems and Contacts</a></li>
</ul>

<hr>

<h3><font color="#0000e0"><a name="Motivation">Motivation</a></font></h3>

OpenBSD is a fairly complete system of its own, but still there is a lot
of software that one might want to see added. However, there is the problem
of where to draw the line as to what to include, as well as the occasional
licensing and export restriction problems.  As OpenBSD is supposed to be
a small stand-alone UNIX-like operating system, some things just can't be
shipped with the system.

<p>
<strong><font color="#e00000">
The ports &amp; packages collection does NOT go through the thorough security audit that OpenBSD follows.
Although we strive to keep the quality of the packages collection high, we just do not have enough human
resources to ensure the same level of robustness and security.
</font></strong>

<p>
The port collection, originally borrowed from
<a href="http://www.freebsd.org/">FreeBSD</a>, fills this gap.
The concept is to have, for each third-party software, a Makefile that
controls
<ul>
<li>where to fetch it,
<li>how to do the fetch,
<li>what it depends upon (if anything),
<li>how to alter the sources (if needed),
<li>and how to configure, build and install it.
</ul>
This information is kept in a directory hierarchy under the
/usr/ports directory.

<p>
Packages are the binary equivalent of ports.  A compiled port becomes
a package that can be registered into the system using 
<a href="http://www.openbsd.org/cgi-bin/man.cgi?query=pkg_add&amp;sektion=1&amp;format=html">pkg_add(1)</a>

<p>
<strong><font color="#e00000">
Packages look like simple <code>.tgz</code> bundles, but they should 
always be added using 
<a href="http://www.openbsd.org/cgi-bin/man.cgi?query=pkg_add&amp;sektion=1&amp;format=html">pkg_add(1)</a>, 
as there might be some extra information that only
<a href="http://www.openbsd.org/cgi-bin/man.cgi?query=pkg_add&amp;sektion=1&amp;format=html">pkg_add(1)</a> 
knows how to handle.</font></strong>
Tip: you can distinguish between packages and <strong>.tgz</strong> bundles 
using 
<a href="http://www.openbsd.org/cgi-bin/man.cgi?query=pkg_info&amp;sektion=1&amp;format=html">pkg_info(1)</a>.

<h3><font color="#0000e0"><a name="Get">Getting Packages</a></font></h3>

A large collection of pre-compiled packages is available for most common
architectures.
<ul>
<li>On the CD-Rom (that you can order <a href="orders.html">here</a>),
<li>On the <a href=ftp.html>ftp mirror sites</a>.
<li>Browsed and retrieved from the web package lists:
<ul>
<li><a href="http://www.openbsd.org/4.3_packages/">Packages for OpenBSD 4.3</a>
<li><a href="http://www.openbsd.org/4.2_packages/">Packages for OpenBSD 4.2</a>
<li><a href="http://www.openbsd.org/4.1_packages/">Packages for OpenBSD 4.1</a>
</ul>
</ul>


Adding a package is as easy as 
<code>pkg_add pkgname</code>.
If you are grabbing packages from a single source (a package repository),
set PKG_PATH to that repository URL, in order to grab dependencies.

<p>
For instance, to install the Gimp package for the 4.3 release on an i386
machine off the ftp site (including dependencies), do:

<pre>
    # export PKG_PATH=ftp://ftp.openbsd.org/pub/OpenBSD/4.3/packages/i386/
    # pkg_add gimp
</pre>

<h3><font color="#0000e0"><a name="stable">Ports and Packages Update for an OpenBSD Release</a></font></h3>
<p>
The 2.7 release saw the introduction of a stable branch for the ports tree.
<p>
For instance, to grab the stable branch for the 4.3 release:
<pre>
    $ cd /usr/ports
    $ cvs -q -d anoncvs@some.anon.server:/cvs up -r OPENBSD_4_3 -Pd
</pre>
<p>
Starting with the 2.8 release, selected binary packages are also made
available.
Please refer to the 
<a href="pkg-stable.html">stable packages page</a> to find out about
updated packages and important updates to the stable branch.
If you want to receive security announcements, you can subscribe
to the ports-security mailing list.
</p>
<p>
Package names are <strong>always</strong> changed in case of a package
update, to avoid any risk of confusion between a package from the release
and a bug-fixed package.
</p>

<h3><font color="#0000e0"><a name="Manage">Managing Installed Packages</a></font></h3>

The <a href="http://www.openbsd.org/cgi-bin/man.cgi?query=packages&amp;sektion=7&amp;format=html">packages(7)</a>
manual page holds useful information about ways to manage
installed packages, solve conflicts (files that already exist) and handle
dependencies.
<p>
Starting with OpenBSD 3.9, an update mechanism is provided by 
<a href="http://www.openbsd.org/cgi-bin/man.cgi?query=pkg_add&amp;sektion=1&amp;format=html">pkg_add(1)</a>.
To update a package (and its dependencies) you must set PKG_PATH to a 
repository URL which contains updates, and use 
<code>pkg_add -ui pkgname</code>.

<h3><font color="#0000e0"><a name="Use">Using Ports</a></font></h3>

If a given package does not exist for your architecture, you may still
be able to compile the port. Besides, some users will want to compile
everything from source for various reasons.

<p>
You can ftp the release version from the pub/OpenBSD/[version] (where
[version] is the release number) directory on any of the
<a href=ftp.html>ftp mirror sites</a>.
The release versions are the ones we ship on our CDROM, and have gone
through more testing than any snapshot.
Further information is available in the 
<a href="http://www.openbsd.org/cgi-bin/man.cgi?query=ports&amp;sektion=7&amp;format=html">ports(7)</a> man page.

<h3><font color="#0000e0"><a name="Life">Life Cycle of the Ports Tree</a></font></h3>

<p>
The ports tree, like the rest of OpenBSD, is constantly changing.  
<p>
The current ports tree <strong>may not</strong> be used with the previous
release.  This is due to changes, typically with the port make process, 
that require code based upon the OpenBSD-current source tree. 
<p>The ports tree works as a single entity. Updating a single directory is
not guaranteed to work, as package dependencies may force you to update
and recompile vast portions of the ports tree.
It is strongly suggested that people don't track ports-current unless
they're prepared to deal with various problems.
<a href=mail.html>Mailing lists</a> such as
<code>ports-changes@openbsd.org</code> or
<code>tech@openbsd.org</code> will probably be invaluable.

<p>You are advised to track ports-stable on a production machine:
we will try to keep the stable ports tree up-to-par with respect to
problems, and to provide timely binary updates as well.

<p>Note that vanishing distfiles is not an issue, as
ftp.openbsd.org holds the complete repository. Even changing checksums is
not an issue: you can issue the command
<pre>
	make checksum REFETCH=true 
</pre>
to make sure you are grabbing the correct distfile for your ports tree.

For definitions of <i>current</i> and <i>stable</i>, see the 
<a href="faq/faq5.html#Flavors">OpenBSD's flavors</a>.


<p>A list of <a href="portsplus/index.html">daily changes</a> to ports
and ports-current is available.

<p>
The ports-current tree can be retrieved via:
<ul>
<li><a href=anoncvs.html>Anonymous CVS</a> (see link).  The command is
essentially <strong>cvs get ports</strong>.
<li>Anonymous ftp from
<a href="ftp://ftp.openbsd.org/pub/OpenBSD/snapshots/ports.tar.gz">
ftp://ftp.openbsd.org/pub/OpenBSD/snapshots/ports.tar.gz</a>.
	This archive is updated nightly.
<li><a href="cvsup.html">CVSup</a>. See the example for using CVSup in
    <a href="cvsup.html#checkout">checkout mode</a>.
<li>Your web browser using the 
<a href="http://www.openbsd.org/cgi-bin/cvsweb/ports/">CVS
	web interface</a>.
</ul>

<h3><font color="#0000e0"><a name="X">Ports and the X Window System</a></font></h3>
There is some special magic in the OpenBSD X configuration files
that allows the ports tree to install imake-based applications under
/usr/local.

<h3><a name="Example"></a><font color="#0000e0">Example Use of the Ports Tree</font></h3>

<p>
Let's say you managed to get a ports tree and you want to compile and
install the archiving utility <strong>unzip</strong>.  You should be able to
	do something like this:

<pre>
    % cd /usr/ports/archivers/unzip
    % su
    # make install clean
    # exit
</pre>

Easy, huh ? Especially considering all that happened in the background:
<ul>
<li>Fetch unzip sources from an ftp site,
<li>Check the source archive integrity,
<li>Extract the unzip source,
<li>Apply OpenBSD specific patches,
<li>Configure and build the program,
<li>Create a binary package under /usr/ports/packages,
<li>Install that package.
</ul>

<p>
With OpenBSD 3.0, almost all ports automatically build
packages when installing.  

<p>
As ports get built, the /usr/ports/distfiles directory gets filled with 
program sources, and /usr/ports/packages gets filled with binary packages.  
Users with low connectivity may refer to 
<a href="http://www.openbsd.org/cgi-bin/man.cgi?query=mirroring-ports&amp;sektion=7&amp;format=html">mirroring-ports(7)</a> for
an efficient way to grab all distfiles at once.  In OpenBSD-current, you 
can use the script /usr/ports/infrastructure/fetch/clean-old to track
old distfiles.
Note that the OpenBSD CD only includes the ports tree and selected packages.
If you wish to have the distfiles, you will have to get them through an
independent way.

<h3><font color="#0000e0"><a name="Advanced"></a>Advanced Usage of the Ports Tree</font></h3>

<p>
Ports tree has many features for the advanced user that make it a valuable
tool beyond basic installation. Advanced users may wish to tamper with
the makefiles (you should read the 
<a href="http://www.openbsd.org/cgi-bin/man.cgi?query=make&amp;sektion=1&amp;format=html">make(1)</a>
manual page first) or set various variables from the make command-line or in 
<tt>/etc/mk.conf</tt>. These variables are described in detail in the
<a href="http://www.openbsd.org/cgi-bin/man.cgi?query=bsd.port.mk&amp;sektion=5&amp;format=html">bsd.port.mk(5)</a>
manual page, and the porting documents below.
</p>

<h3><font color="#0000e0"><a name="Create">Creating New Ports</a></font></h3>
<p>
If you are interested in helping to expand the OpenBSD ports tree
you should first read <a href="porting.html">porting.html</a>.
That page references the 
<a href="http://www.freebsd.org/doc/en_US.ISO8859-1/books/porters-handbook/index.html">
FreeBSD Porter's Handbook</a>
as well as OpenBSD specific policies and hints.

<h3><font color="#0000e0"><a name="Lag">When a Port Is Lagging Behind the Mainstream Version</a></font></h3>

<p>
The ports collection is a volunteer project. Sometimes the project simply 
doesn't have the developer resources to keep everything up-to-date. 
Developers pretty much pick up what they consider interesting and can
test in their environment. Your <a href="goals.html#funding">donations</a>
count for what platforms the ports can be tested on. 
</p>

<p>
Some individual ports may lag behind the mainstream versions because of this.
The ports collection may have a version back of a program from January while a new
version of the program has been released by its developers in May three months ago.
Often this is a conscious decision; the new version may have problems in it on
OpenBSD that the maintainer is trying to solve, or that have simply made the 
application worse than the old version: OpenBSD may have different 
<a href="goals.html">goals</a> than the mainstream developers in other projects,
which sometimes results in features and design or implementation choices
that are undesirable from OpenBSD developers' point of view. The update may also be 
postponed because the new version is not considered a crucial update.
</p>

<p>
If you really need a new version of a port, you should ask the <tt>MAINTAINER</tt>
of the port to update the port (see <a href="#Help">below</a> on how to find out who 
the maintainer is); if you can send patches for this, all the better. To create proper 
patches, you should refer to the <a href="porting.html">documentation on building 
ports</a>.
</p>

<h3><font color="#0000e0"><a name="Help">Problems and Contacts</a></font></h3>

<p>
If you have trouble with an existing port, please send e-mail to the
port maintainer. To see who is the maintainer of the port, type, for
example:
<pre>
       % cd /usr/ports/archivers/unzip
       % make show=MAINTAINER
</pre>
Alternatively, if there is no maintainer, or you can't reach
him/her, send mail to the OpenBSD
ports mailing list, <a href="mailto:ports@openbsd.org">ports@openbsd.org</a>.
Please don't use the misc@openbsd.org mailing list for questions about ports.
Corrections are always welcome, but in any case do please provide:
<ul>
<li>The output of <code>uname -a</code>,
<li>Your OpenBSD version, including any patches you may have applied,
<li>A complete description of the problem.
</ul>
For ports that don't build correctly, a complete build transcript is almost
always required. You can use the portslogger script, found in
/usr/ports/infrastructure/build, for this. A sample run of portslogger
might be:

<pre>
       % cd /usr/ports/archivers/unzip
       % su
       # mkdir -p ~/portslogs
       # make clean install 2>&amp;1 | /usr/ports/infrastructure/build/portslogger \
               ~/portslogs
</pre>

After this, you should have a logfile of the build in your ~/portslogs directory
that you can send to the port maintainer. Also, make sure you are not using
any special options in your build, for example in /etc/mk.conf.

<p>
Alternatively, you can
<ul>
<li>Use <a href="http://www.openbsd.org/cgi-bin/man.cgi?query=script&amp;sektion=1&amp;format=html">script(1)</a> to create a complete build transcript. Don't remove the configure information.
    <li>Attach the output of <a href="http://www.openbsd.org/cgi-bin/man.cgi?query=pkg_info&amp;sektion=1&amp;format=html">pkg_info(1)</a> if it seems even remotely relevant.
    <li><a href="http://www.openbsd.org/cgi-bin/man.cgi?query=gcc&amp;sektion=1&amp;format=html">gcc(1)</a> internal  compiler errors do ask you to report the bug to
the gcc mailing-list. It does save time if you follow their direction, and
provide at least the various files produced by <tt>gcc -save-temps</tt>.
</ul>

<hr>
<a href="index.html"><img height=24 width=24 src=back.gif border=0 alt=OpenBSD></a> 
<a href="mailto:www@openbsd.org">www@openbsd.org</a>
<br><small>$OpenBSD: ports.html,v 1.96 2008/05/13 13:17:20 landry Exp $</small>
</body>
</html>
